package com.chencs.biz.shop.service;

import com.alibaba.fastjson.JSONObject;
import com.chencs.biz.category.service.CategoryService;
import com.chencs.vo.biz.shop.NewShopModel;
import com.chencs.webmvc.rest.RestFullTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by fangzehua on 2017/8/15.
 */

@Service
public class ShopService {
    @Autowired
    RestFullTemplate restTemplate;
    /**标志远程服务url**/
    private static final String URLPATH = "service-common/shop/";

    private static final Logger logger = LoggerFactory.getLogger(ShopService.class.getName());

    public String shopList() throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "shopList", String.class,"");
        logger.info("ShopService shopList zuulGateWay result {}", ret);
        return ret;
    }
    public String newshopList() throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "newshopList", String.class,"");
        logger.info("ShopService shopList zuulGateWay result {}", ret);
        return ret;
    }

    public String addShopModel(NewShopModel model) throws Exception{
        System.out.println(JSONObject.toJSON(model));
        String ret = restTemplate.postForObject(URLPATH + "addShopModel", String.class,model);
        logger.info("ShopService shopList zuulGateWay result {}", ret);
        return ret;
    }

    public String updateShopModel(NewShopModel model) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "updateShopModel", String.class,model);
        logger.info("ShopService shopList zuulGateWay result {}", ret);
        return ret;
    }

    public String delShopModel(String sid) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "delShopModel", String.class,sid);
        logger.info("ShopService shopList zuulGateWay result {}", ret);
        return ret;
    }

    public String findNewShopModel(String sid) throws Exception{
        String ret = restTemplate.postForObject(URLPATH + "findNewShopModel", String.class,sid);
        logger.info("ShopService shopList zuulGateWay result {}", ret);
        return ret;
    }




}
